package com.zhanghe;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
@Service
public class TestService {
	

	@Autowired
	RestTemplate restTemplate;
	
	@HystrixCommand(fallbackMethod = "addServiceFallback")
	public String add(Integer a,Integer b){
		return restTemplate.getForEntity("http://TEST-SERVICE/add?a=10&b=20", String.class).getBody();
	}
	
	public String addServiceFallback(Integer a,Integer b){
		return "error";
	}
}
